package cn.mall.order.mapper;

import cn.mall.order.domain.Order;
import cn.mall.base.mapper.BaseMapper;
import cn.mall.order.domain.UserOrderStatusCounts;
import cn.mall.order.dto.DeleteDto;
import cn.mall.order.dto.SearchByUrlDto;
import cn.mall.order.query.OrderQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author myf
 * @since 2023-12-07
 */
public interface OrderMapper extends BaseMapper<Order> {

    void updateType(@Param("id") Long id, @Param("type") int type);

    List<Order> loadByIdOrType(@Param("ids") List<Long> ids, @Param("type") int type);

    void updateTypeByIds(@Param("ids") List<Long> ids, @Param("type") int type);

    List<Order> loadByUid(Long id);

    Order loadByOid(String oid);

    long loadTotalByUid(OrderQuery query);

    List<Order> loadByShopId(@Param("shopId")Long shopId,@Param("type") int type);

    List<Order> selectByIds(@Param("ids") List<Long> ids);

    long loadnewTotal(Long shopId);

    List<Order> loadRefundOrderByIds(@Param("ids") List<Long> ids);

    List<Order> loadByUrl(SearchByUrlDto searchByUrlDto);

    long loadTotalByUrl(SearchByUrlDto searchByUrlDto);

    void deleteBytime(DeleteDto dto);

    List<Order> loadByProcessing(@Param("shopId")Long shopId,@Param("type") int type);

    UserOrderStatusCounts countOderByUser(Long uid);
    
    /**
     * 查找最近的待处理订单
     * @param limit 限制返回数量
     * @return 待处理订单列表
     */
    List<Order> findRecentPendingOrders(@Param("limit") int limit);
}
